#include "aboutview.h"
#include "imageitem.h"
#include "toolkit.h"
#include <QLocale>

AboutView::AboutView(QWidget *parent) :
    QGraphicsView(parent)
{
    switch(ToolKit::m_language)
    {
    case QLocale::Chinese:
    {
        setBackgroundBrush(QBrush(QImage(":/image/bj.jpg")));
    }
        break;
    case QLocale::HongKong:
    case QLocale::Taiwan:
    {
        setBackgroundBrush(QBrush(QImage(":/image/bf.jpg")));
    }
        break;
    default:
    {
        setBackgroundBrush(QBrush(QImage(":/image/ben.jpg")));
    }
        break;
    }

    m_Scene = new QGraphicsScene(this);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setScene(m_Scene);
    m_Scene->setSceneRect(0.0, 0.0, 640.0, 360.0);

    m_backItem = new ImageItem(QImage(":/image/567.282.png","png"),
                               QRect(QPoint(0,0),QImage(":/image/567.282.png","png").size()));
    m_backItem->setPos(568,282);
    m_backItem->setZValue(2.0);
    m_Scene->addItem(m_backItem);
}

void AboutView::mousePressEvent(QMouseEvent *event)
{
    if(m_backItem->isUnderMouse())
    {
        emit back();
    }
}
